// 投放视频 已抽查ccmark
const cloud = require('wx-server-sdk') 
cloud.init({
  env: "cytfadmini-1gali3r244372a1f" 
})

// 云函数入口函数
// 功能：修改字段ccmark，cc_id的值
exports.main = async (event, context) => {
  // 获取共享环境
  var c1 = new cloud.Cloud({
    resourceAppid: 'wxbfd52ca8da22670f',
    resourceEnv: 'cloud1-4gcsxcql7d341258',
  })
  await c1.init()
  const db = c1.database()
  try {
    c1.database().collection('videoinfo') 
      // .doc(event.videoid)
      .where({
        fileid:event.videoid,
      })
      .update({
        data: {
          ccmark: event.ccmark,
          cc_id: event.cc_id,
        },
      })
  } catch(e) {
    console.error(e)
  }
}